package org.mytools.util;

import java.io.StringWriter;

import org.codehaus.jackson.map.ObjectMapper;

public class JsonUtils {

	private static ObjectMapper objectMapper = new ObjectMapper();

	public static String getJson(Object obj) {
		StringWriter stringWriter = new StringWriter();
		try {
			objectMapper.writeValue(stringWriter, obj);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return stringWriter.toString();
	}

}
